#define _CRT_SECURE_NO_WARNINGS
#include"FunctionCall.h"

int fun1(int* a,int size1,int* b,int size2) {
	int sum = 0;
	for (int i = 0; i < size1; i++) {
		sum += a[i];
	}
	for (int i = 0; i < size2; i++) {
		sum += b[i];
	}
	return sum;
}

void fun1_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<int*>(in[0].value);
	auto b = std::any_cast<int*>(in[1].value);
	out[0].value = fun1(a, in[0].size, b, in[1].size);
}

int fun2(int a, int b) {
	return a*b;
}

void fun2_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<int>(in[0].value);
	auto b = std::any_cast<int>(in[1].value);
	out[0].value = fun2(a, b);
}


const char* fun3(const char* name) {
	std::string str = std::string(name) + "success";
	char* word =new char[100];
	strcpy(word, str.c_str());
	return word;
}


void fun3_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<const char*>(in[0].value);
	out[0].value = fun3(a);
}


double fun4(double a, double b) {
	return a + b;
}

void fun4_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<double>(in[0].value);
	auto b = std::any_cast<double>(in[1].value);
	out[0].value = fun4(a, b);
}


double fun5(double* a, int size1, double* b, int size2) {
	double sum = 0;
	for (int i = 0; i < size1; i++) {
		sum += a[i];
	}
	for (int i = 0; i < size2; i++) {
		sum += b[i];
	}
	return sum;
}

void fun5_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<double*>(in[0].value);
	auto b = std::any_cast<double*>(in[1].value);
	out[0].value = fun5(a, in[0].size, b, in[1].size);
}


std::string fun6(std::string str) {
	return str + "success";
}

void fun6_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<std::string>(in[0].value);
	out[0].value = fun6(a);
}


std::string fun7(std::vector<std::string> strs) {
	std::string result;
	for (auto& str : strs) {
		result += str;
	}
	return result;
}


void fun7_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<std::vector<std::string>>(in[0].value);
	out[0].value = fun7(a);
}



std::vector<std::string> fun8(std::vector<std::string> strs) {
	
	return strs;
}


void fun8_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<std::vector<std::string>>(in[0].value);
	out[0].value = fun8(a);
}


std::vector<double> fun9(std::vector<double> strs) {
	return strs;
}


void fun9_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<std::vector<double>>(in[0].value);
	out[0].value = fun9(a);
}



std::vector<int> fun10(std::vector<int> strs) {
	return strs;
}


void fun10_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<std::vector<int>>(in[0].value);
	out[0].value = fun10(a);
}

char fun11(char c) {
	return c+1;
}


void fun11_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<char>(in[0].value);
	out[0].value = fun11(a);
}


bool fun12(bool c) {
	return !c;
}


void fun12_warpper(std::vector<Parameter>& in, std::vector<Parameter>& out) {
	auto a = std::any_cast<bool>(in[0].value);
	out[0].value = fun12(a);
}